import { MessageBox } from "element-ui";

export default {
  install(Vue, options) {
    Vue.prototype.confirm = (params) => {
      MessageBox.confirm(params.message, params.title || "温馨提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: params.type || "warning",
        center: true
      }).then(() => {
        params.success && params.success(params.id || 0);
      }).catch(() => {
        params.fail && params.fail();
      });
    };
  }
};
